Piano notes book, powered by Astro and React.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

[...slug].astro 545 B

12345678910111213141516171819
  1. ---
  2. import { getCollection } from 'astro:content';
  3. import Layout from '../../content/layouts/Appendix.astro';
  4. export const getStaticPaths = async () => {
  5. const entries = await getCollection('appendices');
  6. return entries.map(entry => ({
  7. params: { slug: entry.slug }, props: { entry },
  8. }));
  9. }
  10. const { entry } = Astro.props;
  11. const { Content } = await entry.render();
  12. const titlePrefix = String.fromCharCode(parseInt(entry.slug) - 1 + 65);
  13. ---
  14. <Layout title={entry.data.title} titlePrefix={`Appendix ${titlePrefix}`}>
  15. <Content />
  16. </Layout>